//
//  WorldTreeModel.h
//  Editor
//
//  Created by Jeppe Nielsen on 11/6/14.
//  Copyright (c) 2014 Jeppe Nielsen. All rights reserved.
//

#pragma once

#include <QtCore/QAbstractItemModel>
#include <QtCore/QModelIndex>
#include <QtCore/QVariant>
#include "GameWorld.hpp"

class WorldTreeModel : public QAbstractItemModel
{
   Q_OBJECT

public:
    explicit WorldTreeModel(QObject *parent = 0);
    virtual ~WorldTreeModel();
    
    void SetWorld(GameWorld* world);

    QVariant data(const QModelIndex &index, int role) const;
    Qt::ItemFlags flags(const QModelIndex &index) const;
    QVariant headerData(int section, Qt::Orientation orientation,
                        int role = Qt::DisplayRole) const;
    QModelIndex index(int row, int column,
                      const QModelIndex &parent = QModelIndex()) const;
    QModelIndex parent(const QModelIndex &index) const;
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    int columnCount(const QModelIndex &parent = QModelIndex()) const;
    Qt::DropActions supportedDropActions() const;
    bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
    QMimeData* mimeData(const QModelIndexList &indexes) const;

private:
    GameObject* draggingGameObject;
    
    GameWorld* world;
};